home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-11-10 | 1.3 KB | 52 lines |
- import java.awt.*;
-
- class SDKDemoFrame extends Frame
- {
- public SDKDemoFrame(String str)
- {
- super (str);
- }
-
- public boolean handleEvent(Event evt)
- {
- switch (evt.id)
- {
- case Event.WINDOW_DESTROY:
- dispose();
- System.exit(0);
- return true;
- default:
- return super.handleEvent(evt);
- }
- }
- public void dispose()
- {
-
- // Set all vars to null to make sure that the reference counts are decremented
- // to release server application
-
- if (parent.theDrawingCanvas.m_IDrawings != null)
- parent.theDrawingCanvas.m_IDrawings.Close(); // close any open TC file
-
- // it is good practice to release the obtained interfaces in reverse or
- // to how they were obtained, although for Java, that is up to the virual
- // machines garbage collection.
- parent.theDrawingCanvas.m_ITheView = null;
- parent.theDrawingCanvas.m_IViews = null;
- parent.theDrawingCanvas.m_ITheDrawing = null;
- parent.theDrawingCanvas.m_IDrawings = null;
- parent.theDrawingCanvas.m_IApp = null;
-
- super.dispose(); // call the action that remove window and resources.
-
- }
-
- public void setParent(SDKDemo parent)
- { this.parent = parent;
- }
-
-
- SDKDemo parent;
- DrawingCanvas theDrawingCanvas = null;
- }
-